﻿using System;
using AutoPageHelper;
namespace AutoIE
{
    interface IProcessor
    {
        /// <summary>
        /// 数据访问
        /// </summary>
        ExcelSource Data { get; }
        /// <summary>
        /// 数据文件
        /// </summary>
        string DataFile { set; }
        /// <summary>
        /// 将使用IE打开指定网址
        /// </summary>
        /// <param name="url">实际网址</param>
        void GoUrl(string url);
        /// <summary>
        /// 初始化，必须在开始调用
        /// </summary>
        /// <param name="CaptureUrl">找到IE依据的Url模式，可以用正则表达式(用^开头，$结尾)</param>
        /// <param name="ExcelFile">数据文件路径</param>
        /// <param name="bOpen">是否打开新的IE窗口</param>
        void Initialize(string CaptureUrl, string ExcelFile, bool bOpen = false);
        /// <summary>
        /// 开始录制流程
        /// </summary>
        /// <remarks>调用此函数无需始化，可以直接调用</remarks>
        /// <param name="CaptureUrl">找到IE依据的Url模式，可以用正则表达式(用^开头，$结尾)</param>
        /// <param name="RecordDirectory">录像内容存放的文件夹，默认为Record</param>
        /// <param name="bOpen">是否自动打开网址，默认为false</param>
        void StartRecord(string CaptureUrl, string RecordDirectory = "Record", bool bOpen = false);
        /// <summary>
        /// 打开新的IE窗口
        /// </summary>
        /// <param name="url">实际网址</param>
        void OpenWindow(string url);
        /// <summary>
        /// 输出到控制台
        /// </summary>
        void Output(string text);
        /// <summary>
        /// 按行输出到控制台
        /// </summary>
        void OutputLine(string text);
        /// <summary>
        /// 验证码识别引擎
        /// </summary>
        IRcgEngine RcgEngine { set; }
        /// <summary>
        /// 验证码识别类库(dll)
        /// </summary>
        string RcgEngineAssembly { set; }
        /// <summary>
        /// 识别验证码
        /// </summary>
        /// <param name="img">要识别的图像</param>
        string Recognise(System.Drawing.Image img);
        /// <summary>
        /// 识别验证码
        /// </summary>
        /// <param name="img">要识别的图像</param>
        string Recognize(System.Drawing.Image img);
        /// <summary>
        /// 等待直到某个网页就绪
        /// </summary>
        void Wait();
        /// <summary>
        /// 等待指定毫秒数
        /// </summary>
        /// <param name="milliseconds">毫秒数</param>
        void Wait(int milliseconds);
        /// <summary>
        /// 等待所有网页就绪
        /// </summary>
        /// <param name="urls">网址列表，可以用正则表达式</param>
        Page[] WaitAllUrl(object[] urls);
        /// <summary>
        /// 等待任意一个网页就绪
        /// </summary>
        /// <param name="urls">网址列表，可以用正则表达式</param>
        Page WaitAnyUrl(object[] urls);
        /// <summary>
        /// 等待一个网页就绪
        /// </summary>
        /// <param name="url">网址，可以用正则表达式</param>
        Page WaitUrl(string url);
        /// <summary>
        /// 将使用IE打开指定网址并等待加载完毕
        /// </summary>
        /// <param name="url">实际网址</param>
        Page GotoUrl(string url);
    }
}
